package com.light.ui;

import com.light.constant.Constant;

import javax.swing.*;
import java.awt.*;

/**
 * @Author MoonlightL
 * @ClassName: MyFrame
 * @ProjectName flappy_bird
 * @Description: 窗体
 * @DateTime 2023/3/13, 0013 10:51
 */
public class MyFrame extends JFrame {

    public MyFrame(String title) {
        this.init(title);
        this.setVisible(true);
    }

    private void init(String title) {
        this.setTitle(title);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        this.setBounds((screenSize.width - Constant.WIN_WIDTH) / 2, (screenSize.height - Constant.WIN_HEIGHT) / 2, Constant.WIN_WIDTH, Constant.WIN_HEIGHT);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(null);
        this.add(new MyPanel());
        this.setResizable(false);
    }
}
